{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "# Marking of data lithofacies(对数据岩相进行标记)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "## Import third-party packages(导入第三方包)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "import os\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "\n",
    "import math\n",
    "import random\n",
    "from pandas import set_option"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# # calculate RMSE\n",
    "# from sklearn.metrics import mean_squared_error, confusion_matrix\n",
    "# import matplotlib.colors as colors\n",
    "# # sklearn.metrics.mean_squared_error(y_true, y_pred, sample_weight=None, multioutput='uniform_average', squared=True)\n",
    "# # https://scikit-learn.org/stable/modules/generated/sklearn.metrics.mean_squared_error.html#sklearn.metrics.mean_squared_error"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# print(tf.__version__)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "numpy+mkl 版本为17.2  \n",
    "tensorboard，tensorflow 版本为2.1.0  \n",
    "pydot版本为1.4.1, graphviz 版本为0.13.2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "## Import our custom package(导入自己的包)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# import senutil as sen\n",
    "# # from rbflayer import RBFLayer, InitCentersRandom\n",
    "# import senmodels_classification as smsc"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# mpl.rcParams['font.sans-serif'] = ['SimHei']\n",
    "# plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签\n",
    "# plt.rcParams['axes.unicode_minus']=False #用来正常显示负号\n",
    "set_option(\"display.max_rows\", 15)\n",
    "set_option('display.width', 200)\n",
    "np.set_printoptions(suppress=True, threshold=5000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# 使用GPU训练时候，打开下面注释\n",
    "os.environ['CUDA_VISIBLE_DEVICES']='0'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "## Preparation work (data processing, result saving location definition)准备工作"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "### Input Curve Dataset Position(输入曲线数据集位置)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "usual_logs_DataPath = 'facies_data/usual_logs/'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "facies_data/usual_logs/古页1_R_0.1m_整段_2350m-2746m_nolabel.csv\n"
     ]
    }
   ],
   "source": [
    "filename_usual_logs = 'GY1_R_0.125m_整段_2350m-2746m_nolabel.csv'\n",
    "\n",
    "usual_logs_DataPath = os.path.join(usual_logs_DataPath,filename_usual_logs)\n",
    "print(usual_logs_DataPath)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "### Location of Petrographic Dataset（岩相数据集所在位置）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "facies_logs_DataPath = 'facies_data/facies_logs/'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "filename_facies_logs =  'GY1-lithofacies-0512.csv'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "facies_logs_DataPath = os.path.join(facies_logs_DataPath,filename_facies_logs)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "## Petrographic data calibration（岩相数据标定）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# 高分辨率相对于低分辨率的倍数, default value = 10 (对应于0.1m); 8 (对应于0.125m)\n",
    "# A sampling rate of 1m\n",
    "resolution = 10"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "### Read input curves and expert lithofacies classification data（读取输入曲线和专家岩相分类数据）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "input_vector_data = pd.read_csv(usual_logs_DataPath,engine='python',encoding='GBK')\n",
    "facies_vector = pd.read_csv(facies_logs_DataPath,engine='python',encoding='GBK')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DEPTH</th>\n",
       "      <th>GR</th>\n",
       "      <th>CNL</th>\n",
       "      <th>DT</th>\n",
       "      <th>DEN</th>\n",
       "      <th>MSFL</th>\n",
       "      <th>RS</th>\n",
       "      <th>RD</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2350.0858</td>\n",
       "      <td>113.4619</td>\n",
       "      <td>15.9331</td>\n",
       "      <td>81.0</td>\n",
       "      <td>2.5902</td>\n",
       "      <td>11.5818</td>\n",
       "      <td>6.9659</td>\n",
       "      <td>7.4271</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2350.1858</td>\n",
       "      <td>116.5655</td>\n",
       "      <td>16.5907</td>\n",
       "      <td>82.8</td>\n",
       "      <td>2.6165</td>\n",
       "      <td>7.7921</td>\n",
       "      <td>7.0260</td>\n",
       "      <td>7.5060</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2350.2858</td>\n",
       "      <td>120.4164</td>\n",
       "      <td>17.4862</td>\n",
       "      <td>85.6</td>\n",
       "      <td>2.6315</td>\n",
       "      <td>6.2955</td>\n",
       "      <td>6.8697</td>\n",
       "      <td>7.3354</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2350.3858</td>\n",
       "      <td>124.4936</td>\n",
       "      <td>18.4462</td>\n",
       "      <td>88.6</td>\n",
       "      <td>2.6291</td>\n",
       "      <td>6.0488</td>\n",
       "      <td>6.5242</td>\n",
       "      <td>6.9516</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2350.4858</td>\n",
       "      <td>128.6494</td>\n",
       "      <td>19.1042</td>\n",
       "      <td>91.0</td>\n",
       "      <td>2.6026</td>\n",
       "      <td>5.9448</td>\n",
       "      <td>6.1002</td>\n",
       "      <td>6.5036</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3956</th>\n",
       "      <td>2745.6858</td>\n",
       "      <td>89.4620</td>\n",
       "      <td>7.3066</td>\n",
       "      <td>71.0</td>\n",
       "      <td>2.5733</td>\n",
       "      <td>7.0714</td>\n",
       "      <td>12.5438</td>\n",
       "      <td>13.1089</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3957</th>\n",
       "      <td>2745.7858</td>\n",
       "      <td>95.4042</td>\n",
       "      <td>7.5931</td>\n",
       "      <td>71.0</td>\n",
       "      <td>2.5846</td>\n",
       "      <td>6.9656</td>\n",
       "      <td>12.6673</td>\n",
       "      <td>13.2187</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3958</th>\n",
       "      <td>2745.8858</td>\n",
       "      <td>104.3638</td>\n",
       "      <td>8.0731</td>\n",
       "      <td>71.0</td>\n",
       "      <td>2.5926</td>\n",
       "      <td>6.8015</td>\n",
       "      <td>12.8980</td>\n",
       "      <td>13.4263</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3959</th>\n",
       "      <td>2745.9858</td>\n",
       "      <td>113.7063</td>\n",
       "      <td>8.9307</td>\n",
       "      <td>71.0</td>\n",
       "      <td>2.5983</td>\n",
       "      <td>6.5375</td>\n",
       "      <td>13.2500</td>\n",
       "      <td>13.7623</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3960</th>\n",
       "      <td>2746.0858</td>\n",
       "      <td>121.4496</td>\n",
       "      <td>9.8662</td>\n",
       "      <td>71.0</td>\n",
       "      <td>2.6050</td>\n",
       "      <td>6.3627</td>\n",
       "      <td>13.6981</td>\n",
       "      <td>14.2150</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>3961 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          DEPTH        GR      CNL    DT     DEN     MSFL       RS       RD\n",
       "0     2350.0858  113.4619  15.9331  81.0  2.5902  11.5818   6.9659   7.4271\n",
       "1     2350.1858  116.5655  16.5907  82.8  2.6165   7.7921   7.0260   7.5060\n",
       "2     2350.2858  120.4164  17.4862  85.6  2.6315   6.2955   6.8697   7.3354\n",
       "3     2350.3858  124.4936  18.4462  88.6  2.6291   6.0488   6.5242   6.9516\n",
       "4     2350.4858  128.6494  19.1042  91.0  2.6026   5.9448   6.1002   6.5036\n",
       "...         ...       ...      ...   ...     ...      ...      ...      ...\n",
       "3956  2745.6858   89.4620   7.3066  71.0  2.5733   7.0714  12.5438  13.1089\n",
       "3957  2745.7858   95.4042   7.5931  71.0  2.5846   6.9656  12.6673  13.2187\n",
       "3958  2745.8858  104.3638   8.0731  71.0  2.5926   6.8015  12.8980  13.4263\n",
       "3959  2745.9858  113.7063   8.9307  71.0  2.5983   6.5375  13.2500  13.7623\n",
       "3960  2746.0858  121.4496   9.8662  71.0  2.6050   6.3627  13.6981  14.2150\n",
       "\n",
       "[3961 rows x 8 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "input_vector_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>层名</th>\n",
       "      <th>起始深度</th>\n",
       "      <th>终止深度</th>\n",
       "      <th>井号</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>低有机质纹层状页岩相</td>\n",
       "      <td>2304.46</td>\n",
       "      <td>2324.88</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>低有机质块状粉砂岩相</td>\n",
       "      <td>2324.88</td>\n",
       "      <td>2326.29</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>低有机质纹层状页岩相</td>\n",
       "      <td>2326.29</td>\n",
       "      <td>2336.86</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>低有机质块状粉砂岩相</td>\n",
       "      <td>2336.86</td>\n",
       "      <td>2337.16</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>低有机质纹层状页岩相</td>\n",
       "      <td>2337.16</td>\n",
       "      <td>2367.19</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>156</th>\n",
       "      <td>高有机质纹层状页岩相</td>\n",
       "      <td>2579.22</td>\n",
       "      <td>2583.54</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>157</th>\n",
       "      <td>低有机质块状介壳灰岩相</td>\n",
       "      <td>2583.54</td>\n",
       "      <td>2584.02</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>158</th>\n",
       "      <td>中有机质纹层状页岩相</td>\n",
       "      <td>2584.02</td>\n",
       "      <td>2584.42</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>159</th>\n",
       "      <td>高有机质纹层状页岩相</td>\n",
       "      <td>2584.42</td>\n",
       "      <td>2585.02</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>160</th>\n",
       "      <td>中有机质纹层状页岩相</td>\n",
       "      <td>2585.02</td>\n",
       "      <td>2586.58</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>161 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "               层名     起始深度     终止深度  井号\n",
       "0    低有机质纹层状页岩相    2304.46  2324.88   1\n",
       "1    低有机质块状粉砂岩相    2324.88  2326.29   1\n",
       "2    低有机质纹层状页岩相    2326.29  2336.86   1\n",
       "3    低有机质块状粉砂岩相    2336.86  2337.16   1\n",
       "4    低有机质纹层状页岩相    2337.16  2367.19   1\n",
       "..            ...      ...      ...  ..\n",
       "156  高有机质纹层状页岩相    2579.22  2583.54   1\n",
       "157   低有机质块状介壳灰岩相  2583.54  2584.02   1\n",
       "158  中有机质纹层状页岩相    2584.02  2584.42   1\n",
       "159  高有机质纹层状页岩相    2584.42  2585.02   1\n",
       "160  中有机质纹层状页岩相    2585.02  2586.58   1\n",
       "\n",
       "[161 rows x 4 columns]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "facies_vector"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# 针对输入曲线\n",
    "depth_cols = 'DEPTH'\n",
    "# 针对岩相曲线\n",
    "depth_begin_col = '起始深度'\n",
    "depth_end_col = '终止深度'\n",
    "facies_col = '层名'\n",
    "well_name_col = '井号'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1], dtype=int64)"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd_well_no = np.full(len(input_vector_data),facies_vector[well_name_col][0])\n",
    "pd_well_no"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "### Lithofacies classification calibration（岩相类别标定）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "facies_label = np.unique(facies_vector[facies_col])\n",
    "\n",
    "'''\n",
    "facies_label = [\n",
    "    \"High organic matter layered shale lithofacies\",\n",
    "    \"High organic striated layered shale lithofacies\",\n",
    "    \"Medium organic striated layered shale lithofacies\",\n",
    "    \"Low organic matter striated layered shale lithofacies\",\n",
    "    \"Medium to low organic matter massive dolomite lithofacies\",\n",
    "    \"Low organic matter massive shell limestone lithofacies\"\n",
    "    \"Low organic matter massive siltstone lithofacies\"\n",
    "]\n",
    "'''\n",
    "\n",
    "facies_labels = ['高有机质层状页岩相', '高有机质纹层状页岩相','中有机质纹层状页岩相','低有机质纹层状页岩相',\n",
    "                '中低有机质块状白云岩相', '低有机质块状介壳灰岩相', '低有机质块状粉砂岩相']\n",
    "\n",
    "\n",
    "# facies_labels = ['层状粘土质页岩', '纹层状粘土质页岩','层状长英质页岩','纹层状长英质页岩','介壳灰岩']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2350, 2600)"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "depth_min = 2350\n",
    "depth_max = 2600\n",
    "math.floor(depth_min),math.ceil(depth_max)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "scrolled": true,
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "9"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# for i in range(math.floor(depth_min),math.ceil(depth_max)+1):\n",
    "#     print(i)\n",
    "len(facies_labels[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "label_max_lenth = 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "for i in range(len(facies_labels)):\n",
    "    if label_max_lenth < len(facies_labels[i]):\n",
    "        label_max_lenth = len(facies_labels[i])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3961"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(input_vector_data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "def generate_random_str(randomlength):\n",
    "    \"\"\"\n",
    "    生成一个指定长度的随机字符串\n",
    "    \"\"\"\n",
    "    random_str = ''\n",
    "    base_str = 'ABCDEFGHIGKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz0123456789'\n",
    "    length = len(base_str) - 1\n",
    "    for i in range(randomlength):\n",
    "        random_str += base_str[random.randint(0, length)]\n",
    "    return random_str\n",
    "# ————————————————\n",
    "# 版权声明：本文为CSDN博主「geerniya」的原创文章，遵循CC 4.0 BY-SA版权协议，转载请附上原文出处链接及本声明。\n",
    "# 原文链接：https://blog.csdn.net/geerniya/java/article/details/78497765"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'wz8BrHlwNb4'"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fill_label = generate_random_str(label_max_lenth)\n",
    "fill_label"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "facies_list = np.full(len(input_vector_data),\"no_label\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "scrolled": true,
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "depth_min,depth_max: 2304.46 2324.88\n",
      "No_0_layers\n",
      "depth_min,depth_max: 2385.35 2387.4\n",
      "No_10_layers\n",
      "depth_min,depth_max: 2416.62 2417.45\n",
      "No_20_layers\n",
      "depth_min,depth_max: 2425.86 2445.17\n",
      "No_30_layers\n",
      "depth_min,depth_max: 2456.34 2458.51\n",
      "No_40_layers\n",
      "depth_min,depth_max: 2462.46 2462.64\n",
      "No_50_layers\n",
      "depth_min,depth_max: 2477.51 2487.88\n",
      "No_60_layers\n",
      "depth_min,depth_max: 2493.21 2495.04\n",
      "No_70_layers\n",
      "depth_min,depth_max: 2499.61 2499.63\n",
      "No_80_layers\n",
      "depth_min,depth_max: 2504.1 2504.14\n",
      "No_90_layers\n",
      "depth_min,depth_max: 2515.75 2515.9\n",
      "No_100_layers\n",
      "depth_min,depth_max: 2521.0 2521.1\n",
      "No_110_layers\n",
      "depth_min,depth_max: 2532.36 2532.56\n",
      "No_120_layers\n",
      "depth_min,depth_max: 2538.32 2539.92\n",
      "No_130_layers\n",
      "depth_min,depth_max: 2547.133 2549.21\n",
      "No_140_layers\n",
      "depth_min,depth_max: 2560.81 2564.26\n",
      "No_150_layers\n",
      "depth_min,depth_max: 2585.02 2586.58\n",
      "No_160_layers\n",
      "Label Work Finished!\n"
     ]
    }
   ],
   "source": [
    "facies_list = np.full(len(input_vector_data),\"no_label\")\n",
    "\n",
    "lower_depth_index = 0\n",
    "# 深度列标尺初始化\n",
    "# current_depth = input_vector_data[depth_cols][0]\n",
    "for i in range(len(facies_vector)):\n",
    "    depth_min = facies_vector[depth_begin_col][i]\n",
    "    depth_max = facies_vector[depth_end_col][i]\n",
    "    current_facies_label = facies_vector[facies_col][i]\n",
    "    current_facies_label = current_facies_label.strip()\n",
    "    # 获取当前岩相表的岩性id\n",
    "    current_facies_id = facies_labels.index(current_facies_label)\n",
    "    # current_well_no = facies_vector[well_name_col][i]\n",
    "    if(i%10==0):\n",
    "        print(\"depth_min,depth_max:\",depth_min,depth_max)\n",
    "        print(\"No_\" + str(i) + \"_layers\")\n",
    "    # lower_depth = math.floor(depth_min)\n",
    "    # upper_depth = math.ceil(depth_max)\n",
    "    for j in range(0,len(input_vector_data)):\n",
    "        current_depth = input_vector_data[depth_cols][j]\n",
    "        if depth_min <= current_depth:\n",
    "            if current_depth <= depth_max:\n",
    "                facies_list[j] = current_facies_id \n",
    "                # pd_well_no[j]  = current_well_no\n",
    "                lower_depth_index = j\n",
    "                # print(str(j) + \":\",current_facies_id)\n",
    "print(\"Label Work Finished!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "wellname_colunm_data = pd.DataFrame(pd_well_no, columns=[\"Well Name\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "facies_colunm_data = pd.DataFrame(facies_list, columns=[\"Facies\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Facies</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3956</th>\n",
       "      <td>no_label</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3957</th>\n",
       "      <td>no_label</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3958</th>\n",
       "      <td>no_label</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3959</th>\n",
       "      <td>no_label</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3960</th>\n",
       "      <td>no_label</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>3961 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        Facies\n",
       "0            3\n",
       "1            3\n",
       "2            3\n",
       "3            3\n",
       "4            3\n",
       "...        ...\n",
       "3956  no_label\n",
       "3957  no_label\n",
       "3958  no_label\n",
       "3959  no_label\n",
       "3960  no_label\n",
       "\n",
       "[3961 rows x 1 columns]"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "facies_colunm_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Well Name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3956</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3957</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3958</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3959</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3960</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>3961 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      Well Name\n",
       "0             1\n",
       "1             1\n",
       "2             1\n",
       "3             1\n",
       "4             1\n",
       "...         ...\n",
       "3956          1\n",
       "3957          1\n",
       "3958          1\n",
       "3959          1\n",
       "3960          1\n",
       "\n",
       "[3961 rows x 1 columns]"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wellname_colunm_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "pd_data = pd.concat([input_vector_data, wellname_colunm_data,facies_colunm_data],axis=1)        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DEPTH</th>\n",
       "      <th>GR</th>\n",
       "      <th>CNL</th>\n",
       "      <th>DT</th>\n",
       "      <th>DEN</th>\n",
       "      <th>MSFL</th>\n",
       "      <th>RS</th>\n",
       "      <th>RD</th>\n",
       "      <th>Well Name</th>\n",
       "      <th>Facies</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2350.0858</td>\n",
       "      <td>113.4619</td>\n",
       "      <td>15.9331</td>\n",
       "      <td>81.0</td>\n",
       "      <td>2.5902</td>\n",
       "      <td>11.5818</td>\n",
       "      <td>6.9659</td>\n",
       "      <td>7.4271</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2350.1858</td>\n",
       "      <td>116.5655</td>\n",
       "      <td>16.5907</td>\n",
       "      <td>82.8</td>\n",
       "      <td>2.6165</td>\n",
       "      <td>7.7921</td>\n",
       "      <td>7.0260</td>\n",
       "      <td>7.5060</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2350.2858</td>\n",
       "      <td>120.4164</td>\n",
       "      <td>17.4862</td>\n",
       "      <td>85.6</td>\n",
       "      <td>2.6315</td>\n",
       "      <td>6.2955</td>\n",
       "      <td>6.8697</td>\n",
       "      <td>7.3354</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2350.3858</td>\n",
       "      <td>124.4936</td>\n",
       "      <td>18.4462</td>\n",
       "      <td>88.6</td>\n",
       "      <td>2.6291</td>\n",
       "      <td>6.0488</td>\n",
       "      <td>6.5242</td>\n",
       "      <td>6.9516</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2350.4858</td>\n",
       "      <td>128.6494</td>\n",
       "      <td>19.1042</td>\n",
       "      <td>91.0</td>\n",
       "      <td>2.6026</td>\n",
       "      <td>5.9448</td>\n",
       "      <td>6.1002</td>\n",
       "      <td>6.5036</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3956</th>\n",
       "      <td>2745.6858</td>\n",
       "      <td>89.4620</td>\n",
       "      <td>7.3066</td>\n",
       "      <td>71.0</td>\n",
       "      <td>2.5733</td>\n",
       "      <td>7.0714</td>\n",
       "      <td>12.5438</td>\n",
       "      <td>13.1089</td>\n",
       "      <td>1</td>\n",
       "      <td>no_label</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3957</th>\n",
       "      <td>2745.7858</td>\n",
       "      <td>95.4042</td>\n",
       "      <td>7.5931</td>\n",
       "      <td>71.0</td>\n",
       "      <td>2.5846</td>\n",
       "      <td>6.9656</td>\n",
       "      <td>12.6673</td>\n",
       "      <td>13.2187</td>\n",
       "      <td>1</td>\n",
       "      <td>no_label</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3958</th>\n",
       "      <td>2745.8858</td>\n",
       "      <td>104.3638</td>\n",
       "      <td>8.0731</td>\n",
       "      <td>71.0</td>\n",
       "      <td>2.5926</td>\n",
       "      <td>6.8015</td>\n",
       "      <td>12.8980</td>\n",
       "      <td>13.4263</td>\n",
       "      <td>1</td>\n",
       "      <td>no_label</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3959</th>\n",
       "      <td>2745.9858</td>\n",
       "      <td>113.7063</td>\n",
       "      <td>8.9307</td>\n",
       "      <td>71.0</td>\n",
       "      <td>2.5983</td>\n",
       "      <td>6.5375</td>\n",
       "      <td>13.2500</td>\n",
       "      <td>13.7623</td>\n",
       "      <td>1</td>\n",
       "      <td>no_label</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3960</th>\n",
       "      <td>2746.0858</td>\n",
       "      <td>121.4496</td>\n",
       "      <td>9.8662</td>\n",
       "      <td>71.0</td>\n",
       "      <td>2.6050</td>\n",
       "      <td>6.3627</td>\n",
       "      <td>13.6981</td>\n",
       "      <td>14.2150</td>\n",
       "      <td>1</td>\n",
       "      <td>no_label</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>3961 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          DEPTH        GR      CNL    DT     DEN     MSFL       RS       RD  Well Name    Facies\n",
       "0     2350.0858  113.4619  15.9331  81.0  2.5902  11.5818   6.9659   7.4271          1         3\n",
       "1     2350.1858  116.5655  16.5907  82.8  2.6165   7.7921   7.0260   7.5060          1         3\n",
       "2     2350.2858  120.4164  17.4862  85.6  2.6315   6.2955   6.8697   7.3354          1         3\n",
       "3     2350.3858  124.4936  18.4462  88.6  2.6291   6.0488   6.5242   6.9516          1         3\n",
       "4     2350.4858  128.6494  19.1042  91.0  2.6026   5.9448   6.1002   6.5036          1         3\n",
       "...         ...       ...      ...   ...     ...      ...      ...      ...        ...       ...\n",
       "3956  2745.6858   89.4620   7.3066  71.0  2.5733   7.0714  12.5438  13.1089          1  no_label\n",
       "3957  2745.7858   95.4042   7.5931  71.0  2.5846   6.9656  12.6673  13.2187          1  no_label\n",
       "3958  2745.8858  104.3638   8.0731  71.0  2.5926   6.8015  12.8980  13.4263          1  no_label\n",
       "3959  2745.9858  113.7063   8.9307  71.0  2.5983   6.5375  13.2500  13.7623          1  no_label\n",
       "3960  2746.0858  121.4496   9.8662  71.0  2.6050   6.3627  13.6981  14.2150          1  no_label\n",
       "\n",
       "[3961 rows x 10 columns]"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "data_save = pd_data[pd_data[\"Facies\"] != \"no_label\"].reset_index(drop=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DEPTH</th>\n",
       "      <th>GR</th>\n",
       "      <th>CNL</th>\n",
       "      <th>DT</th>\n",
       "      <th>DEN</th>\n",
       "      <th>MSFL</th>\n",
       "      <th>RS</th>\n",
       "      <th>RD</th>\n",
       "      <th>Well Name</th>\n",
       "      <th>Facies</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2350.0858</td>\n",
       "      <td>113.4619</td>\n",
       "      <td>15.9331</td>\n",
       "      <td>81.0</td>\n",
       "      <td>2.5902</td>\n",
       "      <td>11.5818</td>\n",
       "      <td>6.9659</td>\n",
       "      <td>7.4271</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2350.1858</td>\n",
       "      <td>116.5655</td>\n",
       "      <td>16.5907</td>\n",
       "      <td>82.8</td>\n",
       "      <td>2.6165</td>\n",
       "      <td>7.7921</td>\n",
       "      <td>7.0260</td>\n",
       "      <td>7.5060</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2350.2858</td>\n",
       "      <td>120.4164</td>\n",
       "      <td>17.4862</td>\n",
       "      <td>85.6</td>\n",
       "      <td>2.6315</td>\n",
       "      <td>6.2955</td>\n",
       "      <td>6.8697</td>\n",
       "      <td>7.3354</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2350.3858</td>\n",
       "      <td>124.4936</td>\n",
       "      <td>18.4462</td>\n",
       "      <td>88.6</td>\n",
       "      <td>2.6291</td>\n",
       "      <td>6.0488</td>\n",
       "      <td>6.5242</td>\n",
       "      <td>6.9516</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2350.4858</td>\n",
       "      <td>128.6494</td>\n",
       "      <td>19.1042</td>\n",
       "      <td>91.0</td>\n",
       "      <td>2.6026</td>\n",
       "      <td>5.9448</td>\n",
       "      <td>6.1002</td>\n",
       "      <td>6.5036</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2360</th>\n",
       "      <td>2586.0858</td>\n",
       "      <td>140.2403</td>\n",
       "      <td>17.6334</td>\n",
       "      <td>93.8</td>\n",
       "      <td>2.6152</td>\n",
       "      <td>5.6501</td>\n",
       "      <td>5.4704</td>\n",
       "      <td>4.4547</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2361</th>\n",
       "      <td>2586.1858</td>\n",
       "      <td>139.1306</td>\n",
       "      <td>17.2158</td>\n",
       "      <td>91.2</td>\n",
       "      <td>2.6213</td>\n",
       "      <td>7.0352</td>\n",
       "      <td>5.6954</td>\n",
       "      <td>4.7051</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2362</th>\n",
       "      <td>2586.2858</td>\n",
       "      <td>136.8668</td>\n",
       "      <td>16.5758</td>\n",
       "      <td>89.2</td>\n",
       "      <td>2.6312</td>\n",
       "      <td>8.4178</td>\n",
       "      <td>5.9588</td>\n",
       "      <td>4.9788</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2363</th>\n",
       "      <td>2586.3858</td>\n",
       "      <td>134.5348</td>\n",
       "      <td>15.9358</td>\n",
       "      <td>88.0</td>\n",
       "      <td>2.6424</td>\n",
       "      <td>8.8941</td>\n",
       "      <td>6.1904</td>\n",
       "      <td>5.2095</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2364</th>\n",
       "      <td>2586.4858</td>\n",
       "      <td>133.1675</td>\n",
       "      <td>15.5224</td>\n",
       "      <td>88.0</td>\n",
       "      <td>2.6498</td>\n",
       "      <td>7.3581</td>\n",
       "      <td>6.2864</td>\n",
       "      <td>5.2975</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2365 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          DEPTH        GR      CNL    DT     DEN     MSFL      RS      RD  Well Name Facies\n",
       "0     2350.0858  113.4619  15.9331  81.0  2.5902  11.5818  6.9659  7.4271          1      3\n",
       "1     2350.1858  116.5655  16.5907  82.8  2.6165   7.7921  7.0260  7.5060          1      3\n",
       "2     2350.2858  120.4164  17.4862  85.6  2.6315   6.2955  6.8697  7.3354          1      3\n",
       "3     2350.3858  124.4936  18.4462  88.6  2.6291   6.0488  6.5242  6.9516          1      3\n",
       "4     2350.4858  128.6494  19.1042  91.0  2.6026   5.9448  6.1002  6.5036          1      3\n",
       "...         ...       ...      ...   ...     ...      ...     ...     ...        ...    ...\n",
       "2360  2586.0858  140.2403  17.6334  93.8  2.6152   5.6501  5.4704  4.4547          1      2\n",
       "2361  2586.1858  139.1306  17.2158  91.2  2.6213   7.0352  5.6954  4.7051          1      2\n",
       "2362  2586.2858  136.8668  16.5758  89.2  2.6312   8.4178  5.9588  4.9788          1      2\n",
       "2363  2586.3858  134.5348  15.9358  88.0  2.6424   8.8941  6.1904  5.2095          1      2\n",
       "2364  2586.4858  133.1675  15.5224  88.0  2.6498   7.3581  6.2864  5.2975          1      2\n",
       "\n",
       "[2365 rows x 10 columns]"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_save"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# facies_id_list = np.full(len(data_save),0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# for i in range(len(data_save)):\n",
    "#     current_facies_id = facies_labels.index(data_save[\"Facies\"][i])\n",
    "#     # print(current_facies_id)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# facies_id = pd.DataFrame(current_facies_id, columns=[\"Facies_id\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# pd_data = pd.concat([pd_data,facies_id],axis=1)       "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "## Label File Results Save（标记结果保存）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "### Result files header information（结果文件文件头信息）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "name": "#%%\n",
     "is_executing": true
    }
   },
   "outputs": [],
   "source": [
    "well_name = filename_facies_logs.split(\".csv\")[0]\n",
    "print(well_name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "name": "#%%\n",
     "is_executing": true
    }
   },
   "outputs": [],
   "source": [
    "# filename_A ： 'HP1_orginLog_6D_4075m-4280m_R_0.125.csv'\n",
    "well_name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DEPTH</th>\n",
       "      <th>GR</th>\n",
       "      <th>CNL</th>\n",
       "      <th>DT</th>\n",
       "      <th>DEN</th>\n",
       "      <th>MSFL</th>\n",
       "      <th>RS</th>\n",
       "      <th>RD</th>\n",
       "      <th>Well Name</th>\n",
       "      <th>Facies</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2350.0858</td>\n",
       "      <td>113.4619</td>\n",
       "      <td>15.9331</td>\n",
       "      <td>81.0</td>\n",
       "      <td>2.5902</td>\n",
       "      <td>11.5818</td>\n",
       "      <td>6.9659</td>\n",
       "      <td>7.4271</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2350.1858</td>\n",
       "      <td>116.5655</td>\n",
       "      <td>16.5907</td>\n",
       "      <td>82.8</td>\n",
       "      <td>2.6165</td>\n",
       "      <td>7.7921</td>\n",
       "      <td>7.0260</td>\n",
       "      <td>7.5060</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2350.2858</td>\n",
       "      <td>120.4164</td>\n",
       "      <td>17.4862</td>\n",
       "      <td>85.6</td>\n",
       "      <td>2.6315</td>\n",
       "      <td>6.2955</td>\n",
       "      <td>6.8697</td>\n",
       "      <td>7.3354</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2350.3858</td>\n",
       "      <td>124.4936</td>\n",
       "      <td>18.4462</td>\n",
       "      <td>88.6</td>\n",
       "      <td>2.6291</td>\n",
       "      <td>6.0488</td>\n",
       "      <td>6.5242</td>\n",
       "      <td>6.9516</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2350.4858</td>\n",
       "      <td>128.6494</td>\n",
       "      <td>19.1042</td>\n",
       "      <td>91.0</td>\n",
       "      <td>2.6026</td>\n",
       "      <td>5.9448</td>\n",
       "      <td>6.1002</td>\n",
       "      <td>6.5036</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2360</th>\n",
       "      <td>2586.0858</td>\n",
       "      <td>140.2403</td>\n",
       "      <td>17.6334</td>\n",
       "      <td>93.8</td>\n",
       "      <td>2.6152</td>\n",
       "      <td>5.6501</td>\n",
       "      <td>5.4704</td>\n",
       "      <td>4.4547</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2361</th>\n",
       "      <td>2586.1858</td>\n",
       "      <td>139.1306</td>\n",
       "      <td>17.2158</td>\n",
       "      <td>91.2</td>\n",
       "      <td>2.6213</td>\n",
       "      <td>7.0352</td>\n",
       "      <td>5.6954</td>\n",
       "      <td>4.7051</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2362</th>\n",
       "      <td>2586.2858</td>\n",
       "      <td>136.8668</td>\n",
       "      <td>16.5758</td>\n",
       "      <td>89.2</td>\n",
       "      <td>2.6312</td>\n",
       "      <td>8.4178</td>\n",
       "      <td>5.9588</td>\n",
       "      <td>4.9788</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2363</th>\n",
       "      <td>2586.3858</td>\n",
       "      <td>134.5348</td>\n",
       "      <td>15.9358</td>\n",
       "      <td>88.0</td>\n",
       "      <td>2.6424</td>\n",
       "      <td>8.8941</td>\n",
       "      <td>6.1904</td>\n",
       "      <td>5.2095</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2364</th>\n",
       "      <td>2586.4858</td>\n",
       "      <td>133.1675</td>\n",
       "      <td>15.5224</td>\n",
       "      <td>88.0</td>\n",
       "      <td>2.6498</td>\n",
       "      <td>7.3581</td>\n",
       "      <td>6.2864</td>\n",
       "      <td>5.2975</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2365 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          DEPTH        GR      CNL    DT     DEN     MSFL      RS      RD  Well Name Facies\n",
       "0     2350.0858  113.4619  15.9331  81.0  2.5902  11.5818  6.9659  7.4271          1      3\n",
       "1     2350.1858  116.5655  16.5907  82.8  2.6165   7.7921  7.0260  7.5060          1      3\n",
       "2     2350.2858  120.4164  17.4862  85.6  2.6315   6.2955  6.8697  7.3354          1      3\n",
       "3     2350.3858  124.4936  18.4462  88.6  2.6291   6.0488  6.5242  6.9516          1      3\n",
       "4     2350.4858  128.6494  19.1042  91.0  2.6026   5.9448  6.1002  6.5036          1      3\n",
       "...         ...       ...      ...   ...     ...      ...     ...     ...        ...    ...\n",
       "2360  2586.0858  140.2403  17.6334  93.8  2.6152   5.6501  5.4704  4.4547          1      2\n",
       "2361  2586.1858  139.1306  17.2158  91.2  2.6213   7.0352  5.6954  4.7051          1      2\n",
       "2362  2586.2858  136.8668  16.5758  89.2  2.6312   8.4178  5.9588  4.9788          1      2\n",
       "2363  2586.3858  134.5348  15.9358  88.0  2.6424   8.8941  6.1904  5.2095          1      2\n",
       "2364  2586.4858  133.1675  15.5224  88.0  2.6498   7.3581  6.2864  5.2975          1      2\n",
       "\n",
       "[2365 rows x 10 columns]"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_save"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "depth_info = data_save[depth_cols]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0       2350.0858\n",
       "1       2350.1858\n",
       "2       2350.2858\n",
       "3       2350.3858\n",
       "4       2350.4858\n",
       "          ...    \n",
       "2360    2586.0858\n",
       "2361    2586.1858\n",
       "2362    2586.2858\n",
       "2363    2586.3858\n",
       "2364    2586.4858\n",
       "Name: DEPTH, Length: 2365, dtype: float64"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "depth_info"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "begin_depth = depth_info[0]\n",
    "end_depth = depth_info[len(depth_info)-1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "begin_depth,end_depth: 2350.0858 2586.4858\n"
     ]
    }
   ],
   "source": [
    "print(\"begin_depth,end_depth:\",begin_depth,end_depth)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# fianl_facies_logs = well_name + '_'+ str(begin_depth) + '-'+ str(end_depth) +'_facies_vectors_' + str(1/resolution)+ '.csv' \n",
    "fianl_facies_logs = well_name + '_facies_vectors_' + str(1/resolution)+ '.csv' "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "name": "#%%\n",
     "is_executing": true
    }
   },
   "outputs": [],
   "source": [
    "print(fianl_facies_logs)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "### Result dataset save location(结果数据集保存位置)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "Using_DataPath = 'facies_data/train/'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "# Using_DataPath = os.path.join(Using_DataPath,fianl_facies_logs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.01"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "resolution_ratio = 1 / resolution\n",
    "resolution_ratio"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "### The saved result curve(保存的结果曲线)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DEPTH</th>\n",
       "      <th>GR</th>\n",
       "      <th>CNL</th>\n",
       "      <th>DT</th>\n",
       "      <th>DEN</th>\n",
       "      <th>MSFL</th>\n",
       "      <th>RS</th>\n",
       "      <th>RD</th>\n",
       "      <th>Well Name</th>\n",
       "      <th>Facies</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2350.0858</td>\n",
       "      <td>113.4619</td>\n",
       "      <td>15.9331</td>\n",
       "      <td>81.0</td>\n",
       "      <td>2.5902</td>\n",
       "      <td>11.5818</td>\n",
       "      <td>6.9659</td>\n",
       "      <td>7.4271</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2350.1858</td>\n",
       "      <td>116.5655</td>\n",
       "      <td>16.5907</td>\n",
       "      <td>82.8</td>\n",
       "      <td>2.6165</td>\n",
       "      <td>7.7921</td>\n",
       "      <td>7.0260</td>\n",
       "      <td>7.5060</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2350.2858</td>\n",
       "      <td>120.4164</td>\n",
       "      <td>17.4862</td>\n",
       "      <td>85.6</td>\n",
       "      <td>2.6315</td>\n",
       "      <td>6.2955</td>\n",
       "      <td>6.8697</td>\n",
       "      <td>7.3354</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2350.3858</td>\n",
       "      <td>124.4936</td>\n",
       "      <td>18.4462</td>\n",
       "      <td>88.6</td>\n",
       "      <td>2.6291</td>\n",
       "      <td>6.0488</td>\n",
       "      <td>6.5242</td>\n",
       "      <td>6.9516</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2350.4858</td>\n",
       "      <td>128.6494</td>\n",
       "      <td>19.1042</td>\n",
       "      <td>91.0</td>\n",
       "      <td>2.6026</td>\n",
       "      <td>5.9448</td>\n",
       "      <td>6.1002</td>\n",
       "      <td>6.5036</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2360</th>\n",
       "      <td>2586.0858</td>\n",
       "      <td>140.2403</td>\n",
       "      <td>17.6334</td>\n",
       "      <td>93.8</td>\n",
       "      <td>2.6152</td>\n",
       "      <td>5.6501</td>\n",
       "      <td>5.4704</td>\n",
       "      <td>4.4547</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2361</th>\n",
       "      <td>2586.1858</td>\n",
       "      <td>139.1306</td>\n",
       "      <td>17.2158</td>\n",
       "      <td>91.2</td>\n",
       "      <td>2.6213</td>\n",
       "      <td>7.0352</td>\n",
       "      <td>5.6954</td>\n",
       "      <td>4.7051</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2362</th>\n",
       "      <td>2586.2858</td>\n",
       "      <td>136.8668</td>\n",
       "      <td>16.5758</td>\n",
       "      <td>89.2</td>\n",
       "      <td>2.6312</td>\n",
       "      <td>8.4178</td>\n",
       "      <td>5.9588</td>\n",
       "      <td>4.9788</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2363</th>\n",
       "      <td>2586.3858</td>\n",
       "      <td>134.5348</td>\n",
       "      <td>15.9358</td>\n",
       "      <td>88.0</td>\n",
       "      <td>2.6424</td>\n",
       "      <td>8.8941</td>\n",
       "      <td>6.1904</td>\n",
       "      <td>5.2095</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2364</th>\n",
       "      <td>2586.4858</td>\n",
       "      <td>133.1675</td>\n",
       "      <td>15.5224</td>\n",
       "      <td>88.0</td>\n",
       "      <td>2.6498</td>\n",
       "      <td>7.3581</td>\n",
       "      <td>6.2864</td>\n",
       "      <td>5.2975</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2365 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          DEPTH        GR      CNL    DT     DEN     MSFL      RS      RD  Well Name Facies\n",
       "0     2350.0858  113.4619  15.9331  81.0  2.5902  11.5818  6.9659  7.4271          1      3\n",
       "1     2350.1858  116.5655  16.5907  82.8  2.6165   7.7921  7.0260  7.5060          1      3\n",
       "2     2350.2858  120.4164  17.4862  85.6  2.6315   6.2955  6.8697  7.3354          1      3\n",
       "3     2350.3858  124.4936  18.4462  88.6  2.6291   6.0488  6.5242  6.9516          1      3\n",
       "4     2350.4858  128.6494  19.1042  91.0  2.6026   5.9448  6.1002  6.5036          1      3\n",
       "...         ...       ...      ...   ...     ...      ...     ...     ...        ...    ...\n",
       "2360  2586.0858  140.2403  17.6334  93.8  2.6152   5.6501  5.4704  4.4547          1      2\n",
       "2361  2586.1858  139.1306  17.2158  91.2  2.6213   7.0352  5.6954  4.7051          1      2\n",
       "2362  2586.2858  136.8668  16.5758  89.2  2.6312   8.4178  5.9588  4.9788          1      2\n",
       "2363  2586.3858  134.5348  15.9358  88.0  2.6424   8.8941  6.1904  5.2095          1      2\n",
       "2364  2586.4858  133.1675  15.5224  88.0  2.6498   7.3581  6.2864  5.2975          1      2\n",
       "\n",
       "[2365 rows x 10 columns]"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_save"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Algorithm is Finished!!\n"
     ]
    }
   ],
   "source": [
    "# 输出txt\n",
    "# data_save.to_csv(os.path.join(Using_DataPath,fianl_facies_logs),mode='w',float_format='%.4f',sep='\\t',index=None,header=True)\n",
    "data_save.to_csv(os.path.join(Using_DataPath,fianl_facies_logs),mode='w',float_format='%.4f',encoding='GBK',index=None,header=True)\n",
    "print(\"Algorithm is Finished!!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "name": "#%%\n",
     "is_executing": true
    }
   },
   "outputs": [],
   "source": [
    "print(os.path.join(Using_DataPath,fianl_facies_logs))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "270.2px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}